package controllers;

import models.DataPersist;
import controllers.sensors.SensorControllerFactory;
import controllers.sensors.SensorControllerFactory.SensorManufacturer;
import controllers.sensors.implementation.tinkerforge.TFConfig;
import controllers.sensors.interfaces.SensorController;
import play.mvc.Controller;

public class Application extends Controller {

    static org.apache.log4j.Logger sensorDataLogger = org.apache.log4j.Logger.getLogger("sensorData");

    private static SensorControllerFactory CONTROLLER_FACTORY = new SensorControllerFactory(SensorManufacturer.TINKERFORGE);

    public static void index() {
        
        
        
        SensorController sensorController = CONTROLLER_FACTORY.getSensorController(new TFConfig(new DataPersist()));
        // Disconnect First because DEV mode of PLAY
        sensorController.disconnectSensors();
        
        sensorController.connectToAvailableSensors();
        render();
    }

    public static void applicationStart() {
        System.out.println("Weeeha");
        index();
    }

}